#include <iostream>
#include "TcpSvr.hpp"
#include "Protocol.hpp"
#include "SvrCal.hpp"

using namespace std;


void test1()
{
    // 测试Request, 序列化 + 添加报头
    Request r(122223, 456, '*');
    string s;
    r.serialize(&s);
    s = encode(s);
    cout << s;

    // 去掉报头
    string out;
    decode(s, &out);
    cout << out << endl;
    
    // 反序列化
    Request tmp;
    tmp.deserialize(out);
    printf("%d %c %d\n", tmp._a, tmp._op, tmp._b);
    printf("===================================\n");
}

void test2()
{
    // 测试Reponse, 序列化 + 添加报头
    Response r(9999, 0);
    string s;
    r.serialize(&s);
    s = encode(s);
    cout << s;

    // 去掉报头
    string out;
    decode(s, &out);
    cout << out << endl;

    // 反序列化
    Response tmp;
    tmp.deserialize(out);
    printf("%d %d\n", tmp._res, tmp._exitCode);
    printf("===================================\n");
}

int main()
{

    return 0;
}